|
|
 |
|
|
|
|
SurfaceValue u, v, X, Y, Z
pline.AddSegment x1, y1, z1, X, Y, Z
x1 = X
y1 = Y
z1 = Z
Next u
Next v
End Sub |
|
|
|
|
|
|
|
|
The Bspline3d class computes surface values much as the Bezier3d class does. The SurfaceValue routine uses the blending functions to create a weighted average of the control points. Although the details of the blending functions themselves are quite different from their Bezier surface counterparts, the way they are used by the SurfaceValue function to calculate points on the surface is the same. |
|
|
|
 |
|
|
|
|
' Return the (X, Y, Z) coordinates of the
' B-spline surface for these u and v values. Private Sub SurfaceValue( _
ByVal u As Single, ByVal v As Single, _
ByRef X As Single, ByRef Y As Single, ByRef Z As Single)
Dim P As Integer
Dim i As Integer
Dim j As Integer
Dim pt As Point3D
Dim Ni As Single
Dim Nj As Single
For i = 0 To MaxU ' Compute Ni. Ni = NValue(i, MaxU, DegreeU, DegreeU, u)
For j = 0 To MaxV ' Compute Nj. Nj = NValue(j, MaxV, DegreeV, DegreeV, v)
' Add to the coordinates. For P = 1 To 3
pt.coord(P) = pt.coord(P) + _
Points(i, j).coord(P) * _
Ni * Nj
Next P
Next j
Next i
' Prepare the output. X = pt.coord(1)
Y = pt.coord(2)
Z = pt.coord(3)
End Sub |
|
|
|
|
|